package com.free.lazy.controller;


import com.free.lazy.common.utils.ApiResult;
import com.free.lazy.entity.LoginParam;
import com.free.lazy.model.User;
import com.free.lazy.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    @PostMapping("/login")
    public ApiResult<User> login(@RequestBody LoginParam loginParam) {
        return ApiResult.success(userService.login(loginParam));
    }
}